package com.sina.shop.service.business;

import com.sina.shop.domain.business.Business;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description: 调用服务，并配置断路器，当调用出错时调用默认的配置。
 * 段浩杰   2018-01-31-17:40
 */
@FeignClient(value = "SHOP-SPRING-CLOUD-ALL", fallback = BusinessServiceBack.class)
public interface BusinessService {

    @RequestMapping(value = "/business/updateBusiness", method = RequestMethod.POST)
    Business updateBusiness(@RequestBody(required = false)Business business);

    @RequestMapping(value = "/business/getBusinessListByAdminId", method = RequestMethod.GET)
    List<Business> getBusinessListByAdminId(@RequestParam("adminId") Long adminId);

    @RequestMapping(value = "/business/getBusinessList", method = RequestMethod.GET)
    Map<String, Object> getBusinessList(@RequestBody(required = false) Business business);

    @RequestMapping(value = "/business/saveBusiness", method = RequestMethod.POST)
    Business saveBusiness(@RequestBody(required = false) Business business);

    @RequestMapping(value = "/business/deleteBusiness", method = RequestMethod.POST)
    Integer deleteBusiness(@RequestParam("id") Long id);


}
